﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="role_edit.aspx.cs" Inherits="admin_user_role_edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>角色管理</title>
<link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="../images/style.css" rel="stylesheet" type="text/css" />
<link href="../select/skins/style.css" rel="stylesheet" type="text/css"    />
<script type="text/javascript" src="../scripts/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../scripts/jquery/jquery.validate.min.js"></script> 
<script type="text/javascript" src="../scripts/jquery/messages_cn.js"></script>
<script type="text/javascript" src="../scripts/ui/js/ligerBuild.min.js"></script>
<script type="text/javascript" src="../js/function.js"></script>
<script type="text/javascript" src="../select/js/select_split.js"></script>
<script type="text/javascript">
    //超级管理员  
    function selFunc() {
        if ($("#ddlRoleType").val() == 1) {
            $(".cball,.config,.member,.inout,.instorage,.staform,.item_view,.item_add,.item_edit,.item_delete").attr("disabled", "disabled");
        }
        else {
            $(".cball,.config,.member,.inout,.instorage,.staform,.item_view,.item_add,.item_edit,.item_delete").attr("disabled", "");
        }
    };
    //重置表单
    function ChangeReset() {
        $("#frmform")[0].reset();
        $("#ddlRoleType ").get(0).selectedIndex = 0;
        selRefresh("ddlRoleType");
    };  
    //选中相关的checkbox
    function SelectedItems(obj, className) {
        if ($(obj).attr("checked") == true) {
            $("." + className).attr("checked", true);
        } else {
            $("." + className).attr("checked", false);
        }
    }
    //表单验证
    $(function () {
        $('#txtRoleName').focus();
        $("#frmform").validate({
            errorElement: "span",
            success: "success",
            invalidHandler: function (e, validator) {
                parent.jsprint("有 " + validator.numberOfInvalids() + " 项填写有误，请检查！", "", "Warning");
            },
            rules: {
                ddlRoleType: "required",
                txtRoleName: {
                    remote: {
                        type: "post",
                        url: "../tools/submit_ajax.ashx?action=validate_role_name",
                        data: {
                            role_name: function () {
                                return $("#txtRoleName").val();
                            },
                            oldrole_name: function () {
                                return $("#hidRoleName").val();
                            }
                        },
                        dataType: "html",
                        dataFilter: function (data, type) {
                            if (data == "true")
                                return true;
                            else
                                return false;
                        }
                    }
                }
            },
            messages: {
                ddlRoleType: "请选择角色类型",
                txtRoleName: { remote: "抱歉，该角色名称已存在" }
            }
        });
    });
</script>
</head>
<body class="mainbody">
<form id="frmform" runat="server" >
<div class="navigation"><a href="javascript:history.go(-1);" class="back">后退</a>首页 &gt; 控制面板 &gt; 角色管理</div>
<div id="navtips" class="navtips">
    相应角色对应相应权限，请按需要设置每个选项！<br />
    <a href="javascript:CloseTip('navtips');" class="close">关闭</a>
</div>
<div id="contentTab">
    <ul class="tab_nav">
        <li class="selected"><a onclick="tabs('#contentTab',0);" href="javascript:;">编辑角色信息</a></li>
    </ul>
    <div class="tab_con" style="display:block;">
        <table class="form_table">
            <col width="180px" />
            <tbody>
            <tr>
                <th>角色名称：</th>
                <td><asp:HiddenField ID="hidRoleName" runat="server" Value="" />
                <asp:TextBox ID="txtRoleName" runat="server" CssClass="txtInput normal required " minlength="2" maxlength="100"></asp:TextBox><label>*</label></td>
            </tr>
            <tr>
                <th>角色类型：</th>
                <td>
                    <%--<asp:DropDownList ID="ddlRoleType" runat="server" CssClass="select2 required"/>--%>
                    <select id="ddlRoleType" runat="server" autowidth="true" onchange="selFunc()" ></select>
                    <label>* 超级用户拥有所有权限，系统用户提供权限选择</label>
                </td>
            </tr>
            <tr>
                <th>角色权限：</th>
                <td>
                    <label style="margin:0;"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'config');" /><b>菜单设置</b></label><label>全选/取消</label>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="item_list">
                    <ul>
                        <asp:Repeater ID="rptList1" runat="server">
                        <ItemTemplate>
                        <li>
                            <asp:HiddenField ID="hidId" Value="0" runat="server" />
                            <asp:HiddenField ID="hidName" Value='<%#Eval("name")%>' runat="server" />
                            <label><input type="checkbox" runat="server" id="cblNavName" value='<%#Eval("value")%>' class="config" /><%#Eval("text")%></label>
                        </li>
                        </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                </td>
            </tr>
             <tr>
                <th></th>
                <td>
                    <label style="margin:0;"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'member');" /><b>系统设置</b></label><label>全选/取消</label>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="item_list">
                    <ul>
                        <asp:Repeater ID="rptList2" runat="server">
                        <ItemTemplate>
                        <li>
                            <asp:HiddenField ID="hidId" Value="0" runat="server" />
                            <asp:HiddenField ID="hidName" Value='<%#Eval("name")%>' runat="server" />
                            <label><input type="checkbox" runat="server" id="cblNavName" value='<%#Eval("value")%>' class="member" /><%#Eval("text")%></label>
                        </li>
                        </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                </td>
            </tr>
             <tr>
                <th></th>
                <td>
                    <label style="margin:0;"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'inout');" /><b>入库出库</b></label><label>全选/取消</label>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="item_list">
                    <ul>
                        <asp:Repeater ID="rptList3" runat="server">
                        <ItemTemplate>
                        <li>
                            <asp:HiddenField ID="hidId" Value="0" runat="server" />
                            <asp:HiddenField ID="hidName" Value='<%#Eval("name")%>' runat="server" />
                            <label><input type="checkbox" runat="server" id="cblNavName" value='<%#Eval("value")%>' class="inout" /><%#Eval("text")%></label>
                        </li>
                        </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                </td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <label style="margin:0;"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'instorage');" /><b>库内管理</b></label><label>全选/取消</label>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="item_list">
                    <ul>
                        <asp:Repeater ID="rptList4" runat="server">
                        <ItemTemplate>
                        <li>
                            <asp:HiddenField ID="hidId" Value="0" runat="server" />
                            <asp:HiddenField ID="hidName" Value='<%#Eval("name")%>' runat="server" />
                            <label><input type="checkbox" runat="server" id="cblNavName" value='<%#Eval("value")%>' class="instorage" /><%#Eval("text")%></label>
                        </li>
                        </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                </td>
            </tr>
             <tr>
                <th></th>
                <td>
                    <label style="margin:0;"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'staform');" /><b>统计报表</b></label><label>全选/取消</label>
                </td>
            </tr>
            <tr>
                <th></th>
                <td class="item_list">
                    <ul>
                        <asp:Repeater ID="rptList5" runat="server">
                        <ItemTemplate>
                        <li>
                            <asp:HiddenField ID="hidId" Value="0" runat="server" />
                            <asp:HiddenField ID="hidName" Value='<%#Eval("name")%>' runat="server" />
                            <label><input type="checkbox" runat="server" id="cblNavName" value='<%#Eval("value")%>' class="staform" /><%#Eval("text")%></label>
                        </li>
                        </ItemTemplate>
                        </asp:Repeater>
                    </ul>
                </td>
            </tr>
           <%-- <tr>
                <th></th>
                <td>
                    <table border="0" cellspacing="0" cellpadding="0" class="border_table">
                        <thead>
                        <tr>
                            <th width="150">频道设置</th>
                            <th width="70"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'item_view');"/>查看</th>
                            <th width="70"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'item_add');"/>添加</th>
                            <th width="70"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'item_edit');"/>修改</th>
                            <th width="70"><input type="checkbox" class="cball" onclick="SelectedItems(this, 'item_delete');"/>删除</th>
                        </tr>
                        </thead>
                        <tbody>
                        <asp:Repeater ID="rptList3" runat="server">
                        <ItemTemplate>
                        <tr class="td_c">
                            <td><asp:HiddenField ID="hidChannelId" Value='<%#Eval("id")%>' runat="server" /><%#Eval("title")%></td>
                            <td><asp:HiddenField ID="hidViewId" Value="0" runat="server" /><input type="checkbox" runat="server" id="cbView" class="item_view" /></td>
                            <td><asp:HiddenField ID="hidAddId" Value="0" runat="server" /><input type="checkbox" runat="server" id="cbAdd" class="item_add" /></td>
                            <td><asp:HiddenField ID="hidEditId" Value="0" runat="server" /><input type="checkbox" runat="server" id="cbEdit" class="item_edit" /></td>
                            <td><asp:HiddenField ID="hidDeleteId" Value="0" runat="server" /><input type="checkbox" runat="server" id="cbDelete" class="item_delete" /></td>
                        </tr>
                        </ItemTemplate>
                        </asp:Repeater>
                        </tbody>
                    </table>
                </td>
            </tr>--%>
            <tr>
                <th></th>
                <td><asp:Button ID="btnSubmit" runat="server" Text="提交保存" CssClass="btnblue" onclick="btnSubmit_Click" /> &nbsp;&nbsp;&nbsp;
                    <input name="重置" type="button" class="btnblue" value="重置" onclick="ChangeReset()" /></td>
            </tr>
            </tbody>
        </table>
    </div>
    
</div>
</form>
</body>
</html>
